package com.bw.area.controller;

import com.bw.area.service.TbDictionaryService;
import com.bw.result.ResultVo;
import com.bw.vo.TagsVo;
import com.bw.vo.TbDictionaryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: FanYangJie
 * @BelongsProject: search-house
 * @BelongsPackage: com.bw.dictionary.controller
 * @Date: 2023/11/12 19:07
 * @Description: TODO
 */
@RestController
@Slf4j
@RequestMapping("/dictionary")
@Api(tags = "字典表管理")
public class DictionaryController {
    @Autowired
    private TbDictionaryService tbDictionaryService;

    /**
     * @deprecated: TODD 查询标签或房源类型
     * @Author: FAnYangJie〔^.べ〕γ
     * @Date: 2023/11/12 19:08
     */
    @PostMapping("/listType")
    @ApiOperation(value = "查询标签或房源类型")
    public ResultVo listType(@RequestBody TbDictionaryVo tbDictionaryVo){
        return tbDictionaryService.listType(tbDictionaryVo);
    }

    /** @Author 李博帅
     * @Description //TODO  前端需要
     * @Date 20:25 2023/11/16
     * @param tbDictionaryVo
     * @return com.bw.result.ResultVo
     **/
    @PostMapping("/listTypeVue")
    @ApiOperation(value = "查询房源类型vue")
    public ResultVo listTypeVue(@RequestBody TbDictionaryVo tbDictionaryVo){
        return tbDictionaryService.listTypeVue(tbDictionaryVo);
    }


    /**
     * @deprecated: TODD 获取对应标签或房源类型
     * @Author: FAnYangJie〔^.べ〕γ
     * @Date: 2023/11/12 19:35
     */
    @PostMapping("/getDictionaryID")
    @ApiOperation(value = "获取对应标签或房源类型")
    public  String getDictionaryID(@RequestBody TbDictionaryVo tbDictionaryVo){
        return  tbDictionaryService.getDictionaryID(tbDictionaryVo);
    }

    @PostMapping("/getTags")
    public List<String> getTags(@RequestBody TagsVo tagsVo){
        return tbDictionaryService.getTags(tagsVo.getSplit());
    };
}
